package com.cly.api.clients;

import com.cly.common.entity.item.dto.ItemDTO;
import com.cly.common.entity.item.po.Item;
import com.cly.common.entity.order.dto.OrderDetailDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

@FeignClient("item-service")
public interface ItemClient {

    /**
     * 根据ids查询商品信息
     * @param ids
     * @return
     */
    @GetMapping("/item/getByIds")
    List<Item> queryItemsByIds(@RequestParam("ids") List<Long> ids);

    @PutMapping("/item/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDto> orderDetailDto);

    @PutMapping("/item/recover/deduct")
    void recoverStock(@RequestBody List<OrderDetailDto> orderDetailDto);
}
